# Maintainer: Chloe Kudryavtsev <toast@toastin.space>
pkgname=minio-client
_pkgname=mc
_pkgver='RELEASE.2020-08-08T02-33-58Z'
pkgver=${_pkgver#*.}
pkgver=${pkgver%T*}
pkgver=0.${pkgver//-}
pkgrel=0
pkgdesc="The MinIO Client"
url="https://minio.io/"
arch="all !mips !mips64" # go is missing
license="Apache-2.0"
makedepends="go"
source="$_pkgname-$pkgver.tar.gz::https://github.com/minio/$_pkgname/archive/$_pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$_pkgver"
options="net"

export GOPATH="$srcdir"
export CGO_ENABLED=0

build() {
	local _ldflags=$(go run buildscripts/gen-ldflags.go 2> /dev/null)
	go build -tags kqueue --ldflags "$_ldflags" -o bin/mc
}

check() {
	# mc/cmd is disabled, seems to be outdated and fails on all my systems
	go test -tags kqueue $(go list ./... | grep -v \
		-e cmd \
		)
}

package() {
	install -Dm755 "$builddir"/bin/mc \
		"$pkgdir"/usr/bin/mcli
}

cleanup_srcdir() {
	go clean -modcache
	default_cleanup_srcdir
}
sha512sums="0965e905e39d8d8a8e5c94ce59d4a9dc822ada78b1baf03f1e87993c19c42058669c29ce28c35003e2f4bf1ff38dc8ca095281b6d9c91a40598e3a3fcdd7be7e  mc-0.20200808.tar.gz"
